layui.use('jquery', function(){
	let $ = layui.jquery;
	//admin名称
    function username() {
        $.ajax({
            type: "GET",
            url: ctx + "index/username",
            success: function (result) {
                if(result.code == 200){
                    $('.admin').text(result.data)
                }
            }
        })
    }
    username();

    //推出账号
    $('#logout').click(function () {
        window.sessionStorage.removeItem("access_token");
        $.ajax({
            type: "GET",
            url: ctx + "logout",
            xhrFields: {//携带cookie信息
                withCredentials: true
            },
            success: function (result) {
                if(result.code == 200){
                    window.location.replace("login.html");
                }
            }
        })
    })
});